package lbim.client.ui;

import java.util.Hashtable;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;

import de.enough.polish.ui.List;
import de.enough.polish.util.Locale;
import java.io.IOException;
import javax.microedition.lcdui.Image;

/**
 *
 * @author tharindu
 */
public class MainScreen extends List implements javax.microedition.lcdui.CommandListener {

    private MainUI ui_;
    private Hashtable commands_;

    public MainScreen() {

        //#style mainscreen1
        super(Locale.get("main.title"), List.IMPLICIT); //[LOCALE]

        ui_ = MainUI.getInstance();
        commands_ = ui_.getCommands();

        try {
            setCommandListener(this);
        } catch (Exception e) {
            e.printStackTrace();
        }
        addCommand((Command) commands_.get(new Integer(MainUI.CMD_EXIT)));
        try {
        //#style mainCommand
        this.append(Locale.get("main.settings"), Image.createImage("/settings.png")); //[LOCALE]
        //#style mainCommand
        this.append(Locale.get("main.login"), Image.createImage("/login.png")); //[LOCALE]
        //#style mainCommand
        this.append(Locale.get("main.help"), Image.createImage("/help.png")); //[LOCALE]
        //#style mainCommand
        this.append(Locale.get("main.about"), Image.createImage("/about.png")); //[LOCALE]
        }catch(IOException ioe) {

        }
        setSelectedIndex(1, true);

    }

    public void commandAction(Command c, Displayable d) {
        MainUI.hsenidCommand(c, d);
    }
}
